//Vue.js官方提供的路由管理器，可以使得单页应用切换页面但不刷新页面
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: Home
  },
  {
    path: '/message',
    name: 'message',
    component: () => import('../views/Message.vue')
  },
  {
    path: '/card',
    name: 'card',
    component: () => import('../views/Card.vue')
  },
  {
    path: '/person',
    name: 'person',
    component: () => import('../views/Person.vue')
  },
  {
    path: '/detail',
    name: 'detail',
    component: () => import('../views/detail.vue')
  },
  {
    path: '/food',
    name: 'food',
    component: () => import('../views/food.vue')
  },
  {
    path: '/set',
    name: 'set',
    component: () => import('../views/set.vue')
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('../views/search.vue')
  }

]

const router = new VueRouter({
  routes
})
router.afterEach((to, from, next) => {
  window.scrollTo(0, 0);
});

export default router
